Combined 3D Rendering Series: 3D Rendering in Windows, 3D Models in Motion, and 3D Articulation by Benton D. James

Combined 3D Rendering Series: 3D Rendering in Windows, 3D Models in Motion, and 3D Articulation by Benton D. James

Author:Benton, D. James [Benton, D. James]
Language: eng
Format: epub, pdf
Publisher: UNKNOWN
Published: 2021-09-23T16:00:00+00:00


Figure 102. Olympic Rings Final Position

Lorenz Attractor

The next combined simple motion we will consider is that of the Lorenz attractor demo written by Aaron Ferrucci and included in the OpenGL™ SDK (may also be found in the online archive). The following description accompanies this demo:

This program shows some particles stuck in a Lorenz attractor (the parameters used are r=28,b=8/3,sigma=10). The eye is attracted to the red particle, with a force directly proportionate to distance. A command line puts the whole mess inside a box made of hexagons. I think this helps to maintain the illusion of 3 dimensions, but it can slow things down. Other options allow you to play with the redraw rate and the number of new lines per redraw. So you can customize it to the speed of your machine.

The biggest difference between this example and the previous ones is that the motion follows a specific pattern described by the physics controlling the motion of the particles. The position of the particles is calculated at each time step in the following function:

void move_eye(void)

{

/* first move the eye */

eyev[0]+=gravity*(rv[rp][0]-eyex[0]);

eyev[1]+=gravity*(rv[rp][1]-eyex[1]);

eyev[2]+=gravity*(rv[rp][2]-eyex[2]);

/* adjust position using new velocity */

eyex[0]+=eyev[0]*dt;

eyex[1]+=eyev[1]*dt;

eyex[2]+=eyev[2]*dt;

/* move the lookat point */

/* it catches up to the red point if it's moving slowly enough */

eyel[0]+=LG*(rv[rp][0]-eyel[0]);

eyel[1]+=LG*(rv[rp][1]-eyel[1]);

eyel[2]+=LG*(rv[rp][2]-eyel[2]);

/* change view */

gluLookAt(eyex[0],eyex[1],eyex[2],eyel[0],

eyel[1],eyel[2],0,1,0);

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.